package com.inspur.jzsxxzx.service.primary.impl;

import com.inspur.jzsxxzx.entity.primary.CataUploadInfo;
import com.inspur.jzsxxzx.mapper.primary.CataUploadInfoMapper;
import com.inspur.jzsxxzx.service.primary.CataUploadInfoService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CataUploadInfoServiceImpl implements CataUploadInfoService {

    @Autowired
    private CataUploadInfoMapper cataUploadInfoMapper;

    @Override
    public int save(CataUploadInfo record) {
        return cataUploadInfoMapper.insert(record);
    }
    
    @Override
    public int batchSave(List<CataUploadInfo> records) {
        return cataUploadInfoMapper.batchInsert(records);
    }

    @Override
    public CataUploadInfo findById(Integer id) {
        return cataUploadInfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public int update(CataUploadInfo record) {
        return cataUploadInfoMapper.updateByPrimaryKey(record);
    }

    @Override
    public int deleteById(Integer id) {
        return cataUploadInfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<CataUploadInfo> findAll() {
        return cataUploadInfoMapper.selectAll();
    }

    @Override
    public CataUploadInfo findByCataBasicIdAndVersion(String cataBasicId, Integer version) {
        return cataUploadInfoMapper.selectByCataBasicIdAndVersion(cataBasicId, version);
    }

    @Override
    public List<CataUploadInfo> findByStatus(Integer status) {
        return cataUploadInfoMapper.selectByStatus(status);
    }

    @Override
    public List<CataUploadInfo> findByCondition(CataUploadInfo condition) {
        return cataUploadInfoMapper.selectByCondition(condition);
    }

    @Override
    public List<CataUploadInfo> findByPage(CataUploadInfo condition, int pageNum, int pageSize) {
        int offset = (pageNum - 1) * pageSize;
        return cataUploadInfoMapper.selectByPage(condition, offset, pageSize);
    }

    @Override
    public int countByCondition(CataUploadInfo condition) {
        return cataUploadInfoMapper.countByCondition(condition);
    }

    @Override
    public int batchUpdateStatus(List<Integer> ids, Integer status) {
        return cataUploadInfoMapper.batchUpdateStatus(ids, status);
    }
}